import re
from sympy import factorint, isprime
from fileinput import FileInput
import os

prime_word = [i.replace('\n','') for i in open('table/primes').readlines() ]
se3 =set(prime_word)
se2 =set()
line1 = 1
filename = '~/pw.txt'
filename = os.path.expanduser(filename)
fi2 = FileInput(filename)

def is_digit(s1):
    for i in s1:
        if i.isdigit():
            return True
    return False

while line1:
    line1 = fi2.readline()
    for str0 in re.split('\W+',line1):
        str0 = str0.replace(' ','')
        str0 = str0.lower()
        if str0.isdigit() or is_digit(str0):
            continue
        try:
            t1 = int(str0,36)
            if isprime(t1) and str0 not in se3:
                se2.add(str0)
        except :
            pass
l2 = list(se2)
l2.sort()
print(l2)

